package model.bean;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;


@Entity
@Table(name="t_experiencia")
public class Experiencia {
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "geradorExperiencia")
	@SequenceGenerator(name = "geradorExperiencia", sequenceName = "sequence_experiencia", allocationSize=1)
	@Column(name="id_experiencia")
	private Long id;
	
	@Column(length=25)
	private String funcao;
	
	@Column(length=25)
	private String empresa;
	
	@Column(name="data_inicio")
	@Temporal(TemporalType.DATE)
	private Date   dataInicio;
	
	@Column(name="data_termino")
	@Temporal(TemporalType.DATE)
	private Date   dataTermino;
	
	@Column(length=19)
	private String tipo;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name="id_curriculo",insertable=true, updatable=true)
	@Fetch(FetchMode.SELECT)
	@Cascade(CascadeType.SAVE_UPDATE)
	private Curriculo curriculo;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getFuncao() {
		return funcao;
	}
	
	public void setFuncao(String funcao) {
		this.funcao = funcao;
	}
	
	public String getEmpresa() {
		return empresa;
	}
	
	public void setEmpresa(String empresa) {
		this.empresa = empresa;
	}
	
	public Date getDataInicio() {
		return dataInicio;
	}
	
	public void setDataInicio(Date dataInicio) {
		this.dataInicio = dataInicio;
	}
	
	public Date getDataTermino() {
		return dataTermino;
	}
	
	public void setDataTermino(Date dataTermino) {
		this.dataTermino = dataTermino;
	}
	
	public String getTipo() {
		return tipo;
	}
	
	public void setTipo(String tipo) {
		this.tipo = tipo;
	}

	public Curriculo getCurriculo() {
		return curriculo;
	}

	public void setCurriculo(Curriculo curriculo) {
		this.curriculo = curriculo;
	}	
	
}
